Beispiel #1
0
 public static function __create()
 {
     $trigger = new static();
     $trigger->sprite_url = 'not-found.png';
     $trigger->map_id = 1;
     $trigger->name = 'Trigger';
     $trigger->x = 50;
     $trigger->y = 50;
     $weaponDealer = clone $trigger;
     $weaponDealer->script = 'merchants/weapon_dealer';
     $weaponDealer->script_arguments = '{"min_level":0,"max_level":80}';
     $weaponDealer->name = 'Weapon Dealer';
     $weaponDealer->map_id = map::load_one('Trainee Village', 'name')->id;
     $weaponDealer->save();
     $weaponDealer->id = null;
     $weaponDealer->name = 'Weapon Dealer';
     $weaponDealer->map_id = map::load_one('Kinata', 'name')->id;
     $weaponDealer->save();
     $dungeonEntrance = clone $trigger;
     $dungeonEntrance->script = 'dungeon_entrance';
     $dungeonEntrance->script_arguments = '{"dungeon_script":"","modes":[0,1,2,3,4,5]}';
     $dungeonEntrance->name = 'Dungeon Entrance';
     $traineeCave = clone $dungeonEntrance;
     $traineeCave->script_arguments = '{"dungeon_script":"trainee_cave","modes":[0,1,2,3,4,5]}';
     $traineeCave->name = 'Trainee Cave';
     $traineeCave->map_id = map::load_one('Trainee Fields', 'name')->id;
     $traineeCave->save();
     $kinataUnderground = clone $dungeonEntrance;
     $kinataUnderground->script_arguments = '{"dungeon_script":"kinata_underground","modes":[0,1,2,3,4,5]}';
     $kinataUnderground->name = 'Kinata Underground';
     $kinataUnderground->x = 100;
     $kinataUnderground->y = 100;
     $kinataUnderground->map_id = map::load_one('Kinata', 'name')->id;
     $kinataUnderground->save();
 }
Beispiel #2
0
 public function index_action()
 {
     $char = character::current();
     $mapId = $char->map_id;
     $map = map::load_one($mapId);
     if (!$map) {
         page::redirect('/world/map-not-found');
     }
     $this->set('map', $map);
 }
Beispiel #3
0
 public function map($newMap = null)
 {
     static $map = null;
     if (!$map) {
         $map = map::load_one($this->map_id);
     }
     if ($newMap) {
         if ($newMap instanceof map) {
             $this->map_id = $newMap->id;
             $this->save();
             $map = $newMap;
         } else {
             if (is_int($newMap)) {
                 $this->map_id = $newMap;
                 $this->save();
                 $map = map::load_one($this->map_id);
             }
         }
     }
     return $map;
 }