Solo usuarios registrados pueden comentar y agradecer, Logueate o Registrate

Autor Topic: Weekly Rewards Plugin for WebEngine CMS  (Visto 127 veces)

0 Miembros and 1 Guest are viewing this topic.

Offline Erou Posteado: October 27, 2025, 02:30:59 PM

  • 0 puntos por ventas
  • *
  • Rank: Principiante
  • Posts: 1
  • Gracias recibida: 16
  • ro
Code: [Select]
# Weekly Rewards - MU Online Plugin

If you like it and use it, don’t forget to say thank you! Good luck

**Version:** 2.0.0

**Author:** D3VO

**Compatibility:** WebEngine CMS 1.2.0 - 1.2.9



---



## 📋 Overview



**Weekly Rewards** is a comprehensive weekly login reward system for MU Online servers. It allows players to claim rewards for each day of the week (Monday through Sunday), with advanced VIP system features for premium accounts.



### Key Features



- ✅ **7-Day Weekly Calendar** - Players can claim different rewards for each day of the week

- ✅ **VIP System** - VIP players can claim rewards from the past 3 days (catch-up feature)

- ✅ **Item Rewards** - Distribute MU Online items directly to player vaults

- ✅ **Credits Alternative** - Option to reward credits instead of items

- ✅ **Beautiful UI** - Modern CSS/JS calendar interface with gradients and animations

- ✅ **Admin CP Integration** - Complete admin panel for reward configuration

- ✅ **Auto Weekly Reset** - Automatic reset every Monday at midnight

- ✅ **Character Online Check** - Verifies if character is online before item distribution



---



## 🎮 How It Works



### For Players



1. **Login to your account**

2. **Go to User CP → Weekly Rewards**

3. **View the 7-day calendar** showing rewards for each day

4. **Check VIP Status:**

   - **VIP Players:** Can claim today, yesterday, or the day before yesterday

   - **Non-VIP Players:** Can only claim today's reward

5. **Click "Claim" button** for available rewards

6. **Items are added to vault** (requires character to be offline)

7. **Credits are added to account** (if configured)



### Reward Calendar



The calendar displays:

- **7 tiles** - One for each day (Monday-Sunday)

- **Item Image** - Visual representation of the reward

- **VIP Badge** - Indicates VIP-only rewards

- **"Claimed" Badge** - Shows completed days

- **Today Highlight** - Highlights current day

- **Locked State** - Shows future days

- **Gradient Animations** - Beautiful purple gradient for claimed items



---



## 🎯 VIP System



### VIP Detection



The plugin automatically detects VIP status from the database:

```sql

MEMB_INFO.AccountLevel > 0 = VIP User

MEMB_INFO.AccountLevel = 0 = Normal User

```



### VIP Benefits



**VIP Players:**

- Can claim rewards for **today**

- Can claim rewards for **yesterday** (if not claimed)

- Can claim rewards for **day before yesterday** (catch-up)

- Can claim **VIP-only rewards**



**Non-VIP Players:**

- Can claim rewards **only for today**

- Cannot claim past rewards

- Cannot claim VIP-only rewards



### Example



```

Today = Friday (Day 5)



VIP User Can Claim:

✅ Wednesday (Day 3) - Yesterday

✅ Thursday (Day 4) - Today

❌ Saturday (Day 6) - Too early



Non-VIP User Can Claim:

❌ Wednesday (Day 3) - Too early

❌ Thursday (Day 4) - Too early

✅ Friday (Day 5) - Only today

```



---



## 📁 File Structure



```

plugins/dailylogin-rewards/__upload/

├── includes/

│   ├── plugins/dailylogin-rewards/

│   │   ├── loader.php                    # Plugin entry point

│   │   ├── config.xml                     # Plugin configuration

│   │   ├── classes/

│   │   │   └── class.weeklyrewards.php   # Core plugin class

│   │   ├── modules/

│   │   │   └── claim.php                 # User claim interface

│   │   ├── languages/en/

│   │   │   └── language.php              # Language phrases

│   │   └── sql/

│   │       ├── WEBENGINE_WEEKLYREWARDS_CLAIMS.txt

│   │       └── WEBENGINE_WEEKLYREWARDS_CONFIG.txt

│   └── cron/

│       └── weeklyrewards_reset.php        # Weekly reset cron

├── modules/

│   └── weeklyrewards/

│       └── claim.php                     # User module

├── admincp/modules/

│   ├── weeklyrewards.php                 # Admin loader

│   └── weeklyrewards/

│       ├── rewards.php                   # Rewards manager

│       ├── settings.php                  # Plugin settings

│       └── stats.php                     # Statistics page

└── plugin_weeklyrewards.xml              # Install package

```



---



## 🚀 Installation



### Step 1: Upload Files



Upload all files from `__upload/` to your WebEngine server:



```

includes/plugins/dailylogin-rewards/  →  includes/plugins/

includes/cron/weeklyrewards_reset.php  →  includes/cron/

modules/weeklyrewards/                →  modules/

admincp/modules/weeklyrewards/         →  admincp/modules/

```



Upload the XML file to root:

```

plugin_weeklyrewards.xml  →  / (server root)

```



### Step 2: Import Plugin



1. Go to **Admin CP**

2. Navigate to **Plugins** section

3. Click **Import Plugin**

4. Upload `plugin_weeklyrewards.xml`

5. Click **Enable Plugin**



### Step 3: Configure Rewards



1. Go to **Admin CP → Weekly Rewards → Rewards Manager**

2. Use the **Day Selector** toolbar to choose a day (1-7)

3. For each day, configure:

   - **Reward Type:** Item or Credits

   - **Item Type:** (0-12)

   - **Item Index:** (0-767) from Item.txt

   - **Item Option:** Select from dropdown (+Luck, DD, DSR, etc.)

   - **Durability:** (0-255)

   - **Item Image URL:** Link to item image

   - **Reward Name:** Display name

   - **Description:** Reward description

   - **VIP Only:** Checkbox for VIP-only rewards

4. Click **Save Reward**



### Step 4: Adjust VIP Check (if needed)



Edit: `includes/plugins/dailylogin-rewards/classes/class.weeklyrewards.php`



Line ~220: Adjust VIP column check if your VIP system uses a different column:



```php

// Default check

$vipCheck = $this->me->query_fetch_single("SELECT TOP 1 AccountLevel FROM MEMB_INFO WHERE memb___id = ?", array($this->_username));



// If you use different column:

// $vipCheck = $this->me->query_fetch_single("SELECT TOP 1 YourVIPColumn FROM MEMB_INFO WHERE memb___id = ?", array($this->_username));

```



---



## ⚙️ Admin Configuration



### Rewards Manager



**Location:** Admin CP → Weekly Rewards → Rewards Manager



**Features:**

- **Day Selector Toolbar** - Choose day 1-7 from dropdown

- **One Day Per Page** - Clean interface for configuration

- **Item Configuration Panel** - Set item details:

  - Item Type (0-12)

  - Item Index (0-767)

  - Item Option (Bitmask dropdown):

    - 0 = No Options

    - 1 = +Luck

    - 2 = +Damage

    - 3 = +Luck +Damage

    - 4 = +Skill

    - 5 = +Luck +Skill

    - 17 = +Luck +AttackRate

    - 32 = DD (Damage Decrease)

    - 64 = DSR (Damage Stats Reduction)

    - 96 = DD +DSR

    - 97 = +Luck +DD +DSR

  - Durability (0-255)

  - Item Image URL

- **Credits Alternative** - Switch to credits instead of items

- **VIP Only Checkbox** - Make reward VIP-exclusive

- **Save Button** - Green notification on success



### Settings



**Location:** Admin CP → Weekly Rewards → Settings



**Configurable Options:**

- Weekly Reset Day (default: Monday)

- Reset Hour and Minute

- VIP Catch-up Days (default: 2)

- Item Distribution Method

- Default Credits Amount

- Credits Config ID



### Statistics



**Location:** Admin CP → Weekly Rewards → Statistics



**Shows:**

- Total Active Users

- Total Claims This Week



---



## 🎮 Item Options Explained



Item options are set using **bitmask values**. Each option has a numeric value, and combining values adds multiple options.



### Basic Options



| Value | Option      | Description                              |

|-------|-------------|------------------------------------------|

| 1     | +Luck       | Adds luck to item                        |

| 2     | +Damage     | Adds extra damage                        |

| 4     | +Skill      | Adds skill option                        |

| 8     | +Speed      | Adds attack speed                        |

| 16    | +AttackRate | Adds attack rate                         |



### Advanced Options



| Value | Option | Description                        |

|-------|--------|------------------------------------|

| 32    | DD     | Damage Decrease (defensive)        |

| 64    | DSR    | Damage Stats Reduction (defensive) |



### Combined Options



| Value | Options              |

|-------|----------------------|

| 3     | +Luck +Damage        |

| 5     | +Luck +Skill         |

| 7     | +Luck +Damage +Skill |

| 17    | +Luck +AttackRate    |

| 33    | +Luck +DD            |

| 35    | +Luck +Damage +DD    |

| 96    | DD +DSR              |

| 97    | +Luck +DD +DSR       |



### Examples



**Light Saber with +Luck:**

```

Item Type: 0

Item Index: 10

Item Option: 1    (+Luck)

Durability: 255

```



**Divine Sword with all options:**

```

Item Type: 0

Item Index: 19 (Divine Sword of Archangel)

Item Option: 97   (+Luck +DD +DSR)

Durability: 255

```



---



## 💾 Database Structure



### WEBENGINE_WEEKLYREWARDS_CLAIMS



Stores player claim data for the current week:



```sql

- username                    varchar

- week_start_date             date (Monday of current week)

- monday_claimed              tinyint

- tuesday_claimed             tinyint

- wednesday_claimed           tinyint

- thursday_claimed            tinyint

- friday_claimed              tinyint

- saturday_claimed            tinyint

- sunday_claimed              tinyint

- monday_claim_date           datetime

- tuesday_claim_date          datetime

... (dates for all 7 days)

- status                      tinyint

```



### WEBENGINE_WEEKLYREWARDS_CONFIG



Stores reward configuration for each day:



```sql

- day_number                  int (1-7)

- reward_type                 varchar ('item' or 'credits')

- item_type                   int (0-12)

- item_index                  int (0-767)

- item_option                 int (bitmask)

- item_durability             int (0-255)

- item_image_url              varchar

- credits_amount              int

- reward_name                 varchar

- reward_description          text

- vip_only                    tinyint (0 or 1)

- status                      tinyint (0 or 1)

```



---



## 🔧 Item Distribution



### How Items Are Added



1. **Check Character Online Status**

   - Queries `Character.CtlCode` from MuOnline database

   - If online (CtlCode = 1) → Error: "Please logout"

   - If offline (CtlCode = 0) → Continue



2. **Generate Item Code**

   - Creates 12-byte binary item code

   - Format: `[Type(1)][Reserved(1)][Index(2)][Serial(4)][Options(1)][Durability(1)][Additional(2)]`



3. **Add to Vault**

   - Gets user's vault from `warehouse` table (MuOnline DB)

   - Inserts item at position: `Number * 12 bytes`

   - Updates `Items` column (varbinary)

   - Increments `Number` counter



### Item Code Format



Each item is **12 bytes** in warehouse:



```

Byte 0:   Item Type (0-12)

Byte 1:   Reserved (0)

Bytes 2-3: Item Index (2 bytes, little-endian)

Bytes 4-7: Serial Number (4 bytes, random)

Byte 8:   Options (bitmask for +Luck, DD, DSR, etc.)

Byte 9:   Durability (0-255)

Bytes 10-11: Additional data (0, 0)

```



---



## ⚡ Automatic Features



### Weekly Reset



- **Cron Job:** `weeklyrewards_reset.php`

- **Schedule:** Every Monday at 00:00

- **Function:** Clears all claims and starts new week



### Character Online Check



- Checks `Character.CtlCode` before item distribution

- Prevents item loss if character is online

- Shows error: "Your character is online! Please logout to receive the item."



### VIP Auto-Detection



- Queries `MEMB_INFO.AccountLevel` on login

- Automatically determines VIP status

- Applies appropriate claim restrictions



---



## 🎨 User Interface



### Calendar Design



- **7-Day Grid Layout** - Horizontal or vertical tiles

- **Gradient Backgrounds** - Purple gradient for claimed items

- **VIP Badge** - Gold border for VIP-only rewards

- **Today Highlight** - Blue glow for current day

- **Claimed Badge** - Green checkmark for completed days

- **Locked State** - Gray for future days

- **Item Images** - 64x64px item icons



### Responsive Design



- Works on desktop and mobile

- Adaptive grid layout

- Touch-friendly buttons



---



## 🔐 Security Features



- **User Authentication** - Requires login

- **VIP Status Verification** - Checks database

- **Character Ownership Check** - Verifies character belongs to user

- **Online Status Check** - Prevents item loss

- **Input Validation** - Sanitizes all inputs

- **SQL Injection Protection** - Prepared statements



---



## 📊 User Experience Flow



### Daily Login Reward Claim



```

1. User logs in

2. Goes to User CP → Weekly Rewards

3. Sees calendar with 7 days

4. Checks which days are available (VIP vs Non-VIP)

5. Clicks "Claim" button

6. Character online check:

   → If online: Error message

   → If offline: Item added to vault

7. Item appears in game vault

8. Calendar updates to show "Claimed"

```



### VIP Catch-up Flow



```

VIP User logs in on Friday:

- Missed Wednesday reward

- VIP can claim Wednesday (catch-up)

- Can claim Thursday (yesterday)

- Can claim Friday (today)

- Saturday not available yet

```



---



## 💡 Customization



### Change Weekly Reset Day



Edit `config.xml`:

```xml

<reset_day>1</reset_day>  <!-- 1=Monday, 2=Tuesday, etc. -->

```



### Change VIP Catch-up Days



Edit `config.xml`:

```xml

<vip_catchup_days>2</vip_catchup_days>  <!-- 0-6 days -->

```



### Change Item Distribution Method



Options:

- `warehouse` - Add to vault (default)

- `inventory` - Add to character inventory



---



## 🐛 Troubleshooting



### "Table not found" Error



**Solution:** Run plugin installation again. The plugin will auto-create tables.



### "Could not access vault" Error



**Solution:** Check warehouse table exists in MuOnline database:

```sql

SELECT * FROM warehouse WHERE AccountID = 'your_account_id'

```



### "VIP not detected" Error



**Solution:** Verify VIP column in MEMB_INFO table:

```sql

SELECT AccountLevel FROM MEMB_INFO WHERE memb___id = 'username'

```



### "Character is online" Error



**Solution:** Character must logout from game to receive items.



### Items Not Appearing



**Check:**

1. Character is offline (CtlCode = 0)

2. Vault is not full (max 32 items)

3. Item code was generated correctly

4. Database connection is working



---



## 📝 Configuration Examples



### Example 1: Simple Credits Reward



```php

Reward Type: Credits

Credits Amount: 5000

VIP Only: No

```



### Example 2: Basic Item with +Luck



```php

Reward Type: Item

Item Type: 0 (Weapon)

Item Index: 10 (Light Saber)

Item Option: 1 (+Luck)

Durability: 255

Image URL: https://yourserver.com/images/light_saber.jpg

VIP Only: No

```



### Example 3: VIP-Only Premium Item



```php

Reward Type: Item

Item Type: 0 (Weapon)

Item Index: 19 (Divine Sword of Archangel)

Item Option: 97 (+Luck +DD +DSR)

Durability: 255

Image URL: https://yourserver.com/images/divine_sword.jpg

VIP Only: Yes

```



---



## 🎯 Best Practices



### Reward Progression



**Early Week (Monday-Wednesday):**

- Credits (1000-5000)

- Basic items with +Luck

- Potions and consumables



**Mid Week (Thursday-Friday):**

- Mid-tier items

- +Luck +Damage items

- Better rewards



**Weekend (Saturday-Sunday):**

- Premium items

- VIP-only rewards

- +Luck +DD +DSR items



### VIP-Only Rewards



Use VIP-only for:

- Premium items

- Weekend rewards (Saturday-Sunday)

- Special event rewards



---



## 📦 Uninstall



To uninstall the plugin:



1. Go to **Admin CP → Plugins**

2. Find "Weekly Rewards"

3. Click **Uninstall**

4. Manual cleanup (optional):

   ```sql

   DROP TABLE WEBENGINE_WEEKLYREWARDS_CLAIMS

   DROP TABLE WEBENGINE_WEEKLYREWARDS_CONFIG

   DELETE FROM webengine_cron WHERE cron_file_run = 'weeklyrewards_reset.php'

   ```



---



## 🔄 Changelog



### Version 2.0.0



- Initial release

- Weekly 7-day calendar

- VIP system with catch-up

- Item distribution to vault

- Credits alternative

- Admin CP configuration

- Auto weekly reset

- Character online check

- Beautiful UI with animations



---



## 📞 Support



For issues, questions, or feature requests:

- Check troubleshooting section

- Review database structure

- Verify configuration settings

- Check WebEngine error logs



---



## 📄 License



This plugin is provided as-is for use with WebEngine CMS.



---



## 🎉 Summary



**Weekly Rewards** is a complete, professional-grade weekly login reward system for MU Online servers. It provides players with daily rewards, VIP catch-up features, and admin configuration tools.



**Key Benefits:**

- ✅ Player engagement

- ✅ VIP premium features

- ✅ Admin control

- ✅ Beautiful user interface

- ✅ Automatic reset

- ✅ Item or credits rewards



**Ready for production use! 🚀**









If you like it and use it, don’t forget to say thank you! Good luck:)





DOWNLOAD



Gracias:


Solo usuarios registrados pueden comentar y agradecer, Logueate o Registrate


 

Related Topics

  Subject / Started by Replies Last post
0 Replies
808 Views
Last post April 13, 2020, 09:59:05 AM
by Specifier
0 Replies
1350 Views
Last post April 16, 2020, 09:54:14 AM
by Specifier
16 Replies
6332 Views
Last post July 25, 2024, 11:05:48 PM
by alexsaw
9 Replies
2942 Views
Last post September 28, 2023, 01:18:25 PM
by kheroz95
0 Replies
458 Views
Last post February 12, 2022, 09:09:22 AM
by Wikka